<?php if(!defined('WANYA_ROOT')) {exit('error!');}?>
<script language="javascript" type="text/javascript" src="editor/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
	tr {height: 40px}
</style>
<div class=containertitle><b>学生信息编辑</b>
	<?php if(isset($_GET['active_del'])):?><span class="actived">删除用户成功</span><?php endif;?>
	<?php if(isset($_GET['active_show'])):?><span class="actived">编辑用户资料成功</span><?php endif;?>
</div>
<div class=line></div>
	<form action="student_list.php" name="userupdateform" id="userupdateform" method="post">
	<table align="center">
		<tr>
			<td>
				用户姓名：　　
			</td>
			<td>
				<input type="text" name="name" id="name" value="<?php echo($student["name"]);?>">
			</td>
		</tr>

		<tr>
			<td>
				电　　话：　　
			</td>
			<td>
				<input type="text" name="tel" id="tel" value="<?php echo($student["tel"]);?>">
			</td>
		</tr>
		<tr>
			<td>
				性　　别：　　
			</td>
			<td>
				<select name="sex" >
					<option value ="1" <?php echo($student["sex"]==1)?'selected':'';?>>男</option>
					<option value ="2" <?php echo($student["sex"]==2)?'selected':'';?>>女</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				生　　日：　　
			</td>
			<td>
				<input class="Wdate" type="text" name="birthday" value="<?php echo($student["birthday"]);?>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
			</td>
		</tr>
		<tr>
			<td>
				家长姓名：　　
			</td>
			<td>
				<input type="text" name="parent_name" id="parent_name" value="<?php echo($student["parent_name"]);?>">
			</td>
		</tr>

		<tr>
			<td>
				家长电话1：　　
			</td>
			<td>
				<input type="text" name="parent_tel1" id="parent_tel1" value="<?php echo($student["parent_tel1"]);?>">
			</td>
		</tr>
		<tr>
			<td>
				家长电话2：　　
			</td>
			<td>
				<input type="text" name="parent_tel2" id="parent_tel2" value="<?php echo($student["parent_tel2"]);?>">
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="button" name="cancel" value="取消" onclick="formCancel()" class="button">	　　　
				<input type="button" name="confirm" value="确认" onclick="formCheck()" class="button">　　
			</td>
		</tr>
	</table>
		<input type="hidden" name="ID" value="<?php echo($student["ID"]);?>">
		<input type="hidden" name="action" value="<?php echo($action);?>">
		<input type="hidden" name="mode" value="commit">　
	</form>
<script type="text/javascript">
	function formCheck()
	{
		if($("#name").val()=="")
		{
			alert("请输入姓名！");
			return;
		}
		var tel = $("#tel").val();
		var parent_tel1 = $("#parent_tel1").val();
		var parent_tel2 = $("#parent_tel2").val();
		var partten = /^1[3,4,5,6,7,8]\d{9}$/g;
		var partten1 = /^1[3,4,5,6,7,8]\d{9}$/g;
		var partten2 = /^1[3,4,5,6,7,8]\d{9}$/g;
		if(tel=="")
		{
			alert("请输入手机号！");
			return;
		}
		if(!partten.test(tel))
		{
			alert("请输入正确的手机号！");
			return;
		}
		if(parent_tel1!="")
		{
			if(!partten1.test(parent_tel1))
			{
				alert("家长电话1格式输入错误！");
				return;
			}
		}
		if(parent_tel2!="")
		{
			if(!partten2.test(parent_tel2))
			{
				alert("家长电话2格式输入错误！");
				return;
			}
		}
		$("#userupdateform").submit();
	}
	function formCancel()
	{
		window.location.href="student_list.php";
	}
	setTimeout(hideActived,2600);
</script>